<?php

/**
 * GlAdvertisement form base class.
 *
 * @method GlAdvertisement getObject() Returns the current form's model object
 *
 * @package    GREEN_LIGHT
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseGlAdvertisementForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'advertisement_id' => new sfWidgetFormInputHidden(),
      'name'             => new sfWidgetFormInputText(),
      'link'             => new sfWidgetFormInputText(),
      'picture'          => new sfWidgetFormInputText(),
      'content'          => new sfWidgetFormTextarea(),
      'display_position' => new sfWidgetFormInputText(),
      'position'         => new sfWidgetFormInputText(),
      'number_clicks'    => new sfWidgetFormInputText(),
      'is_active'        => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'advertisement_id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('advertisement_id')), 'empty_value' => $this->getObject()->get('advertisement_id'), 'required' => false)),
      'name'             => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'link'             => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'picture'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'content'          => new sfValidatorString(array('required' => false)),
      'display_position' => new sfValidatorInteger(array('required' => false)),
      'position'         => new sfValidatorInteger(array('required' => false)),
      'number_clicks'    => new sfValidatorInteger(array('required' => false)),
      'is_active'        => new sfValidatorInteger(array('required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('gl_advertisement[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'GlAdvertisement';
  }

}
